<template>
	<view>
		<view class="buttonclass">
			<view class="buttonbox">
				<button plain="true" @click="gotoNextPage">跳过</button>
			</view>
		</view>
		<view class="bigbox">
			<view class="box">
				<image src="../../static/mylogo.png" mode="aspectFit"></image>
				<text>研海</text>
			</view>
		</view>
		<view class="subtitle">
			<text>越努力越幸运</text>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad() {
			//获取本地信息，如果之前登录过，跳转至首页，否则跳转至登录界面。
			setTimeout(function() {
				uni.getStorage({
					key: 'userId',
					success: function(res) {
						getApp().globalData.userId = res.data
						if (res.data != "") {
							// console.log("起始页获取到账号：", res.data)
							uni.switchTab({
								url: "../firstpage/FirstPage"
							})
						}
					},
					fail: function() {
						uni.navigateTo({
							url: "./enter"
						})
					}
				})
				// uni.navigateTo({
				// 	url: "./enter"
				// })
			}, 2000)
		},
		methods: {
			gotoNextPage() {
				uni.getStorage({
					key: 'userId',
					success: function(res) {
						getApp().globalData.userId = res.data
						if (res.data != "") {
							console.log("起始页获取到账号：", res.data)
							uni.switchTab({
								url: "../firstpage/FirstPage"
							})
						}
					},
					fail: function() {
						uni.navigateTo({
							url: "./enter"
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.buttonclass {
		//background-color: #2C405A;
		display: flex;
		flex-direction: row;
		justify-content: flex-end;

		.buttonbox {
			//background-color: #2C405A;
			margin-right: 30rpx;
			margin-top: 60rpx;

			button {
				display: flex;
				align-items: center;
				justify-content: center;
				width: 150rpx;
				height: 80rpx;
				color: #8F8F94;
				border-color: #8F8F94;
				border-radius: 100rpx;
			}
		}
	}

	.bigbox {
		display: flex;
		flex-direction: row;
		justify-content: center;

		.box {
			margin-top: 300rpx;
			//background-color: #333333;
			//height: 150rpx;
			//width: 200rpx;
			display: flex;
			flex-direction: row;

			image {
				//background-color: #4CD964;
				height: 250rpx;
				width: 250rpx;
			}

			text {
				display: flex;
				align-items: center;
				justify-content: center;
				//margin-top: 50rpx;
				font-size: 100rpx;
				font-weight: bold;
				//background-color: #F0AD4E;
			}
		}
	}

	.subtitle {
		margin-top: 30vh;
		//background-color: #007AFF;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;

		text {
			color: #808080;
		}
	}
</style>
